#include "basesynctax.h"
#include <QString>
#include <stdio.h>
#include <QObject>
#include <QMetaObject>
#include <QQmlProperty>
#include "../cqmlbasesynctax.h"
BaseSynctaxCpp::BaseSynctaxCpp(QObject *parent) : QObject(parent),
    index(0)
{

}

QString BaseSynctaxCpp::baseSynctax()
{
    QString tmp;
    QString code;
    tmp="xxx";
    QObject * obj=CQmlBaseSynctaxCpp::Instance()->getObj("CppBaseSynctax_info");
    if(obj){
       qDebug()<<"show all:"<<tmp;
       QQmlProperty::write(obj,"text",tmp);
    }
    PushInfo(tmp);
    ShowInfo(tmp);
    return tmp;
}

int BaseSynctaxCpp::getIndex()const
{
    qDebug()<<"CppObject getName";
    return index;
}
int BaseSynctaxCpp::setIndex(int i)
{
    qDebug()<<"CppObject setName";
    index=i;
    return index;
}

void BaseSynctaxCpp::PushInfo(QString info)
{
     info_list<<info;
}

void BaseSynctaxCpp::ShowInfo(QString info)
{

    QString show_all;
    for(int i=0;i<info_list.size();i++)
    {
        show_all+=info_list.at(i);
    }

    QObject * obj=CQmlBaseSynctaxCpp::Instance()->getObj("CppBaseSynctax_info");
    if(obj){
       qDebug()<<"show all:"<<show_all;
       QQmlProperty::write(obj,"text",show_all);
    }
}
